/*=+--+=#=+--     Unmanned Aerial System Management Software      --+=#=+--+=#*\
|          Copyright (C) 2011 Regents of the University of Colorado.           |
|                             All Rights Reserved.                             |

     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License version 2 as
     published by the Free Software Foundation.

     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.

     You should have received a copy of the GNU General Public License
     along with this program.  If not, see <http://www.gnu.org/licenses/>.

            Jack Elston                       Cory Dixon                        
|           elstonj@colorado.edu              dixonc@colorado.edu              |
|                                                                              |
\*=+--+=#=+--                 --+=#=+--+=#=+--                    --+=#=+--+=#*/

#ifndef __DHLCONFIG
#define __DHLCONFIG

/**
 * This file defines the CUPIC global variables and various configuration options.
 * Configure the CUPIC's Stream Capabilities/Commands here.
 * Also configure each flock's coordinator here.
 *
 * It also defines the typedefs used throughout this project for 
 * cross-platofrom compatibility: cu_uchar_t (1 byte), cu_uint_t (2 bytes), and
 * cu_ulong_t (4 bytes).
 */

#include "definedCommands.h"

#define CUPIC

#ifdef CUPIC

typedef unsigned char cu_uchar_t;
typedef unsigned int cu_uint_t;
typedef unsigned long cu_long_t;
#define ATTRIBUTE_PACKED

/***********************************************************\
|            DHL Configurable Parameters                    |
\***********************************************************/
#define COORDINATOR_ADDR    (0xFFFF)
// Set COORIDNATOR_ADDR to 0xFFFF if you want to be able to command a flock from a GS too
// Otherwise set to the address of this DS's DHL Coordinator

#define MAX_FLOCK_SIZE      (5)

// Set the stream capabilities you want the DS to have in ds_streams
// Then set NUM_STREAMS to be the size of ds_streams array
#define NUM_STREAMS         (2)
cu_uchar_t ds_streams[NUM_STREAMS] = {
    CMD_DEBUG,
    CMD_HOUSE_KEEPING,
};

// Set the command capabilities you want the DS to be able to recieve
// Then set NUM_COMMANDS to be the size of ds_streams array
// Note that 1 is the minimum size
#define NUM_COMMANDS    (1)
cu_uchar_t ds_commands[NUM_COMMANDS] = { 
    0x00
};
/***********************************************************\
|              End Configurable Parameters                  |
\***********************************************************/

#define NUM_COLUMNS             (NUM_STREAMS)
#define NUM_ROWS                (MAX_FLOCK_SIZE)

// The subscription_addresses table stores who has subscribed to a node's 
// capabilities. 
// On startup, each entry in the table is zero.
// When a node subscribes to a capability (which maps to a column, based on the order of the ds_streams vector), it's address is placed in the first empty location.
// Streams are then published to non-zero addresses in the table. 
// To unsubscribe, a nodes address is set to zero
cu_uint_t subscription_addresses[NUM_ROWS][NUM_COLUMNS] = { '\0' };

// Capabilities Sequence Number
cu_uchar_t capabilities_seq = 0;
cu_uchar_t custody_seq = 0;
#endif // CUPIC


#ifdef NETUAS_MS
#include "definedCommands.h"

typedef unsigned char cu_uchar_t;
typedef unsigned short cu_uint_t;
typedef unsigned int cu_long_t;
#define ATTRIBUTE_PACKED __attribute__((packed))
#endif

#endif // __DHLCONFIG
